/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pc
 */
@Entity
@Table(name = "cinema")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cinema.findAll", query = "SELECT c FROM Cinema c"),
    @NamedQuery(name = "Cinema.findByCinemaID", query = "SELECT c FROM Cinema c WHERE c.cinemaID = :cinemaID"),
    @NamedQuery(name = "Cinema.findByCinemaName", query = "SELECT c FROM Cinema c WHERE c.cinemaName = :cinemaName"),
    @NamedQuery(name = "Cinema.findByCinemaLocation", query = "SELECT c FROM Cinema c WHERE c.cinemaLocation = :cinemaLocation"),
    @NamedQuery(name = "Cinema.findByCinemaLastSeat", query = "SELECT c FROM Cinema c WHERE c.cinemaLastSeat = :cinemaLastSeat")})
public class Cinema implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "cinemaID")
    private Integer cinemaID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "cinemaName")
    private String cinemaName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "cinemaLocation")
    private String cinemaLocation;
    @Column(name = "cinemaLastSeat")
    private Integer cinemaLastSeat;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cinemaID")
    private List<Showtime> showtimeList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cinema")
    private List<Seatcinema> seatcinemaList;

    public Cinema() {
    }

    public Cinema(Integer cinemaID) {
        this.cinemaID = cinemaID;
    }

    public Cinema(Integer cinemaID, String cinemaName, String cinemaLocation) {
        this.cinemaID = cinemaID;
        this.cinemaName = cinemaName;
        this.cinemaLocation = cinemaLocation;
    }

    public Integer getCinemaID() {
        return cinemaID;
    }

    public void setCinemaID(Integer cinemaID) {
        this.cinemaID = cinemaID;
    }

    public String getCinemaName() {
        return cinemaName;
    }

    public void setCinemaName(String cinemaName) {
        this.cinemaName = cinemaName;
    }

    public String getCinemaLocation() {
        return cinemaLocation;
    }

    public void setCinemaLocation(String cinemaLocation) {
        this.cinemaLocation = cinemaLocation;
    }

    public Integer getCinemaLastSeat() {
        return cinemaLastSeat;
    }

    public void setCinemaLastSeat(Integer cinemaLastSeat) {
        this.cinemaLastSeat = cinemaLastSeat;
    }

    @XmlTransient
    public List<Showtime> getShowtimeList() {
        return showtimeList;
    }

    public void setShowtimeList(List<Showtime> showtimeList) {
        this.showtimeList = showtimeList;
    }

    @XmlTransient
    public List<Seatcinema> getSeatcinemaList() {
        return seatcinemaList;
    }

    public void setSeatcinemaList(List<Seatcinema> seatcinemaList) {
        this.seatcinemaList = seatcinemaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cinemaID != null ? cinemaID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cinema)) {
            return false;
        }
        Cinema other = (Cinema) object;
        if ((this.cinemaID == null && other.cinemaID != null) || (this.cinemaID != null && !this.cinemaID.equals(other.cinemaID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidad.Cinema[ cinemaID=" + cinemaID + " ]";
    }
    
}
